package com.bfxy.conllector.web;

import com.bfxy.conllector.util.InputMDC;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 顾志杰
 * @date 2020/9/1-16:11
 */
@RestController
@Slf4j
public class IndexController {

    @GetMapping("/index")
    public String index(){
        InputMDC.putMDC();
        log.info("我是一条info日志");
        log.warn("我是一条warn日志");
        log.error("我是一条error日志");
//        throw new RuntimeException("报个错娱乐下");
        return "idx";
    }

    @GetMapping("/err")
    public String error(){
        InputMDC.putMDC();
        try {
            int a = 1 / 0;
        } catch (Exception e) {
            log.error("算数异常",e);
        }
        return "error";
    }
}
